<html>

<head>

<script src="jquery-1.5.2.min.js"></script>

<title>Dreambox</title>

<style>
.button{
	background: gray; color:white;width: 50px;
} 
</style>

<script type="text/javascript" src="osami_fin.js"></script>

<script type="text/javascript">

var HID_QUERY = "org.osami.HID_MANAGER_QUERY";
var HID_RESPONSE = "org.osami.HID_MANAGER_RESPONSE";

window.onload = function(){
	try{
		OSAMI.setupOSGi2IntentConversion('org/osami/*', "org.osami.test.android");
		OSAMI.setupIntentListener(HID_RESPONSE);
		
		$("#log").append("testing<br>");

		OSAMI.addOsgiEventListener("org/osami/TEST", function(topic, data){
			for(var a in data){
				$("#log").append(a+":"+data[a]+"<br>");
			}
		});
		
		$("#log").append("testing2<br>");

		window.OSAMI._processOSGiEvent('org/osami/TEST', {"event.topics":"org/osami/TEST","test":"property"});
	
		OSAMI.addIntentListener(HID_RESPONSE, function(data){
			for(var a in data){
				$("#log").append(a+":"+data[a]+"<br>");
			}
		});
	
		$("#log").append("testing3");
	}catch(e){
		$("#log").append(String(e));
	}
}

function test1(){
	OSAMI.postOSGiEvent('org/osami/TEST', {"test" : "property"});
	
}

function test2(){
	
	//window.OSAMI._processAndroidIntent({"programs":[{"start":1304603454127,"description":"Valtakunnan kuumimmat ja polttavimmat jutut","end":1304603457727,"name":"Uutiset"}],"intent":"org.osami.HID_MANAGER_RESPONSE"});
	
	OSAMI.postAndroidIntent({
		action : HID_QUERY,
		extras : {
			"query"    : "org/osami/PROGRAMS",
			"deviceID" : "tvbox"
		}
	});
}

</script>

</head>

<body>

<div class="button" onclick="test1()">
Test 1
</div>

<br>

<div class="button" onclick="test2()">
Test 2
</div>

<div id="log">
</div>

</body>

</html>

